﻿@page "/menus"
@using GMS.NET.Dto.System.Menus.Shared
@using GMS.NET.Dto.System.Menus.Enums
@using GMS.NET.Web.Components.Pages.Systems.Menus.Shared
@attribute [TabItemOption(Text = "菜单管理")]

<Card IsShadow="true" HeaderText="菜单管理">
    <BodyTemplate>
        <Table TItem="MenusTree" IsBordered="true" IsStriped="true" IndentSize="8" HeaderStyle="@TableHeaderStyle.Light"
               TreeIcon="fa-solid fa-circle-chevron-right" IsTree="true" TreeNodeConverter="@TreeNodeConverter"
               OnTreeExpand="@OnTreeExpand" OnQueryAsync="@OnQueryAsync" ShowToolbar="true" ShowExtendButtons="true"
               OnSaveAsync="@OnSaveAsync" OnDeleteAsync="@OnDeleteAsync" ShowEditButton="false" EditDialogIsDraggable="true"
               AddModalTitle="新增菜单" EditModalTitle="编辑菜单" ShowEmpty="true" @ref="Table"
               IsMultipleSelect="true">
            <TableColumns>
                <TableColumn @bind-Field="@context.Res_Name" />
                <TableColumn @bind-Field="@context.Res_Icon">
                    <Template Context="value">
                        <span class="@value.Value"></span>
                    </Template>
                </TableColumn>
                <TableColumn @bind-Field="@context.Res_CssClass" />
                <TableColumn @bind-Field="@context.Res_Name" />
                <TableColumn @bind-Field="@context.Res_Type" />
                <TableColumn @bind-Field="@context.Res_Sort" />
                <TableColumn @bind-Field="@context.Res_Disabled">
                    <Template Context="value">
                        <Switch Value="@(value.Value==Res_Disabled.normal)" ValueChanged="(val)=>ResDisabledOnChanged(val,value.Row.Id)"
                                OnColor="Color.Success" OnText="正常" OffText="禁用"></Switch>
                    </Template>
                </TableColumn>
                <TableColumn @bind-Field="@context.Res_Url" />
                <TableColumn @bind-Field="@context.Res_Remark" />
            </TableColumns>
            <EditTemplate Context="value">
                <MenusForm context="value" />
            </EditTemplate>
        </Table>
    </BodyTemplate>
</Card>

